var request = require('request');
var fs = require('fs');

/*
* url 网络文件地址
* filename 文件名
* callback 回调函数
*/
function downloadFile(url,filename,callback){
    var stream = fs.createWriteStream(filename);
    request(url).pipe(stream).on('close', callback); 
}

var fileUrl  = 'http://www.jijidown.com/DownLoad/Cid/14171531?token=6E0090246F3C75E54B1C333548777F44';
var filename = '14171531.flv';
downloadFile(fileUrl,filename,function(){
    console.log(filename+'下载完毕');
});